/*
 * @作者: 沙昊
 * @邮箱: shahao@zju.edu.cn
 * @功能: 
 * @包含算法: 
 * Copyright (c) 2023 by 沙昊, All Rights Reserved. 
 */

#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <queue>
using namespace std;


/*
获取整行：
string input;
getline(cin, input);
stringstream stringin(input);
int num;
vector<int> a;
while (stringin >> num) {
  a.push_back(num);
}

获取单个数字：
cin >> m >> n;
for (int i = 0; i < m; i++) {
    int c;
    cin >> c;
    files.push_back(c);
}

*/



int main() {
  cout<<"shahao"<<endl;
  vector<vector<int>> arr;
  string input;
  while (getline(cin, input)) {
    cout<<"shahao1"<<endl;
    if (input.size() > 0) {
      stringstream stringin(input);
      int num;
      vector<int> a;
      while (stringin >> num) {
        a.push_back(num);
      }
      arr.push_back(a);
    }
  }

  sort(arr.begin(),arr.end());
//cin>>n;

  // 使用自测数据按钮时调试用，正式提交时要删掉。
  cout << "rows: " << arr.size() << ", cols: " << arr[0].size() << endl;
  for (int i=0; i<arr.size(); i++) {
    for (int j=0; j<arr[i].size(); j++) {
      cout << arr[i][j] << " ";
    }
    cout << endl;
  }
  return 0;
}

